﻿<%@ Page Language="C#" AutoEventWireup="true" Inherits="_Default" CodeBehind="Default.aspx.cs" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Form Saver Demo</title>
</head>
<body style="font-family: Verdana">
	<form id="form1" runat="server">
		<asp:ScriptManager ID="UXScriptManager" runat="server" />
		<div>
			<h2>
				Demo of FormStateSaver in ASP.NET WebForms.</h2>
			<p>
				This is a test form.<br />
				1) Try to fill out a few fields and submit. You should see the results.<br />
				2) Dont' click any buttons, wait 1 minute, and submit. You will be required to log
				on. After log on, your form post will be magically restored.<br />
				<br />
				Your Forms Authentication ticket will expire in <span id="counter">60</span> seconds...
				<br />
			</p>
			<br />
			<asp:TextBox ID="UXFirstTextbox" runat="server" /><br />
			<asp:TextBox ID="UXSecondTextbox" runat="server" /><br />
			<asp:ListBox ID="UXListbox" runat="server">
				<asp:ListItem Text="Option 1" Value="Option 1" />
				<asp:ListItem Text="Option 2" Value="Option 2" />
			</asp:ListBox>
			<asp:CheckBox ID="UXCheckbox" runat="server" Text="Checked?" />
			<br />
			<br />
			<asp:Button ID="UXSubmit" runat="server" Text="Submit" />
			<br />
			<br />
			<asp:UpdatePanel ID="UXAjaxPanel" runat="server">
				<ContentTemplate>
					<asp:Label ID="UXAjaxLabel" runat="server">Oh, and let's try within an Ajax UpdatePanel:</asp:Label><br />
					<asp:TextBox ID="UXAjaxText1" runat="server" /><br />
					<asp:ListBox ID="UXAjaxListbox" runat="server">
						<asp:ListItem Text="Option 1" Value="Option 1" />
						<asp:ListItem Text="Option 2" Value="Option 2" />
					</asp:ListBox>
					<br />
					<asp:Label ID="UXAjaxTime" runat="server" /><br />
					<br />
					<asp:Button ID="UXAjaxSubmit" runat="server" Text="Ajax submit" OnClick="UXAjaxSubmit_Click" />
				</ContentTemplate>
			</asp:UpdatePanel>
		</div>
	</form>

	<script language="javascript" type="text/javascript">
		var seconds = 60;
		document.getElementById("counter").innerHTML = '60';

		function display() {
			seconds -= 1;
			document.getElementById("counter").innerHTML = seconds;
			if (seconds > 0)
				setTimeout("display()", 1000);
		}
		display();
	</script>

</body>
</html>
